package ch16;

import javafoundations.LinearNode;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.function.Consumer;

/**
 * Created by zhangyunqi on 2017/10/22.
 */
public class ArrayIterator<T> implements Iterator<T> {
    private LinearNode <T> iter;
    private ArrayList list;
    public ArrayIterator ()
    {
        iter=null;
        list=null;

    }
    public void add(Object obj) {
        this.list.add ( obj );
    }
    public String toString() {
        String result = "";
        LinearNode<T> current = iter;
        while (current != null) {
            result = result + (current.getElement ()).toString () + "\n";
            current = current.getNext ();
        }
        return result;
    }

    public Iterator<T> iterator() {
        return null;
    }

    public void forEach(Consumer<? super T> action) {

    }


    @Override
    public boolean hasNext() {
        return false;
    }

    @Override
    public T next() {
        return null;
    }

    @Override
    public void remove() {

    }

    public void forEachRemaining(Consumer <? super T> action) {

    }
}
